package cmsi.Controller;

import net.lcheng.model.Banner;
import net.lcheng.model.PProduct;
import net.lcheng.service.BannerService;
import net.lcheng.service.PProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by zwr on 2016/8/27.
 */
@Controller
public class HomeController {
    @Autowired
    private PProductService pProductService;
    @Autowired
    private BannerService bannerService;
    @RequestMapping("/home")
    public String home(Model model){
        List<PProduct> pProductList = pProductService.getPProductByStatus(1);
        model.addAttribute("pProductList", pProductList);
        /**获取店铺Banner从排序(order_num)从大到小排序*/
        List<Banner>bannerList= bannerService.getBannerList();
        model.addAttribute("bannerList",bannerList);
        return "home";
    }
}
